[deps]

[main]
filesize=1876711
sha512=e680c3ae4270b517bbd27de0d3aa3885bbbc935cc716cdddf45a2adb4a1ad5019a791d56348390cc802cf72e45f50f00287ed5c9b6621c211976855263a8ead9

[mirrors]
http://fedorahosted.org/releases/e/l/elfutils/0.152/elfutils-0.152.tar.bz2
http://dbg.download.sourcemage.org/mirror/elfutils-0.152.tar.bz2

[build]
patch -Np1 -i $K/elfutils-portability.patch || exit 1
patch -Np1 -i $K/elfutils-musl-compat.patch || exit 1

sed -i 's@loff_t@off_t@g' libelf/libelf.h
sed -i "/stdint/s@.*@&\n#define TEMP_FAILURE_RETRY(x) x\n#define rawmemchr(s,c) memchr((s),(size_t)-1,(c))@" lib/system.h
sed -i '/cdefs/d' lib/fixedsizehash.h
sed -i -e \
      "s@__BEGIN_DECLS@#ifdef __cplusplus\nextern \"C\" {\n#endif@" \
      -e "s@__END_DECLS@#ifdef __cplusplus\n}\n#endif@" libelf/elf.h
sed -i 's@__mempcpy@mempcpy@g' libelf/elf_begin.c 
CC="$CC -static -D_LARGEFILE64_SOURCE" ./configure -C --prefix="$butch_prefix" \
    --disable-shared \
    --disable-nls \
    ac_cv_tls=no || exit 1
find . -name Makefile -exec sed -i 's/-Werror//g' '{}' \;
find . -name Makefile -exec sed -i 's/if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi$//' "{}" \;
sed -i 's,am__EXEEXT_1 = libelf.so$(EXEEXT),,' libelf/Makefile
sed -i 's,install: install-am libelf.so,install: install-am\n\nfoobar:\n,' libelf/Makefile
make -C libelf -j$MAKE_THREADS || exit 1
make -C libelf install || exit 1


